package cn.ikun.xk.JDBC;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class AppJdbcUpdate {
    public static void main(String[] args) throws Exception{
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/baga?useSSL=false";
        String username = "root";
        String password = "xk20011216";
        Connection connection = DriverManager.getConnection(url, username, password);


        //3、创建陈述句对象
        Statement statement = connection.createStatement();
        String sql = "UPDATE `jk_user` SET `username` = 'bbb' WHERE id = 3";
        int i = statement.executeUpdate(sql);
        if (i>0){
            System.out.println("更新成功");
        }

    }

}
